﻿// ==========================================================================
// SourceFileContent.cs
// Silverlight Shapes Library
// ==========================================================================
// Copyright (c) Silverlight Shapes Development Group
// All rights reserved.
// ==========================================================================

using System;
namespace SD.Samples.Views
{
    /// <summary>
    /// Represents the name and the content of onesource file.
    /// </summary>
    public sealed class SourceFileContent
    {
        /// <summary>
        /// Gets the name of the sample where the code file belongs to.
        /// </summary>
        /// <value>The name of the sample where the code file belongs to.</value>
        public string Sample { get; private set; }

        /// <summary>
        /// Gets the name of the source file.
        /// </summary>
        /// <value>The name of the source file.</value>
        public string FileName { get; private set; }

        /// <summary>
        /// Gets or sets the content of the source file.
        /// </summary>
        /// <value>The content of the source file.</value>
        public string Content { get; set; }

        /// <summary>
        /// Initializes a new instance of the <see cref="SourceFileContent"/> class with
        /// the sample where the source file belongs to and the name of the source file.
        /// </summary>
        /// <param name="sample">The sample where the source file belongs to. Cannot be null or empty.</param>
        /// <param name="sourceFile">The name of the source file. Cannot be null or empty.</param>
        /// <exception cref="ArgumentException">
        /// 	<para><paramref name="sourceFile"/> is null or empty.</para>
        /// 	<para>- or -</para>
        /// 	<para><paramref name="sample"/> is null or empty.</para>
        /// </exception>
        public SourceFileContent(string sample, string sourceFile)
        {
            if (sample == null)
            {
                throw new ArgumentException("Sample cannot be null or empty.", "sample");
            }

            if (sample == null)
            {
                throw new ArgumentException("Source file cannot be null or empty.", "sourceFile");
            }

            Sample = sample;

            FileName = sourceFile;
        }
    }
}
